package collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo {
    public static void main(String[] args) {
        //无泛型
        Collection collection  = new ArrayList();
        collection.add("那英");
        collection.add("张杰");
        collection.add("单依纯");
        collection.add("陈奕迅");
        System.out.println(collection);
        collection.remove("那英");
        System.out.println(collection.contains("那英"));
        System.out.println(collection.isEmpty());
        //泛型
        Collection<String> collection1 = new ArrayList<>();
        collection1.add("张杰");
        collection1.add("那英");
        collection1.add("李建");
        System.out.println(collection1);
        //System.out.println(collection.removeAll(collection1));
        System.out.println(collection);
        System.out.println(collection.retainAll(collection1));
        System.out.println(collection);

    }
}
